package org.com.lcuiot.utils;

import org.com.lcuiot.config.IotMsgListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.http.ReactiveHttpInputMessage;
import org.springframework.web.reactive.function.BodyExtractor;
import reactor.core.publisher.Flux;

/**
 * @author gaoge
 * @since 2022/10/28 09:20
 */
public class IotMsgExtrator implements BodyExtractor {
    private static final Logger logger = LoggerFactory.getLogger(IotMsgExtrator.class);

    @Override
    public Object extract(ReactiveHttpInputMessage inputMessage, Context context) {
        Flux<DataBuffer> body = inputMessage.getBody();
        logger.info("------Extracting {}", inputMessage.getBody());
        logger.info("------Extracting {}", inputMessage.getHeaders());
        return null;
    }
}
